package 面试常见刷题;

import java.util.Arrays;

public class 选择排序 {
    public static void main(String[] args) {
        int[] ints = {1, 213, 12, 31, 41, 12};
        chooseSort(ints);
        System.out.println(Arrays.toString(ints));
    }

    private static void chooseSort(int[] data) {
        for (int i = 0; i < data.length; i++) {
            int t = i;
            for (int j = i+1; j < data.length; j++) {
                if(data[t]>data[j]){
                    t = j;
                }
            }
            if(t != i){
                工具类.swap(data,i,t);
            }
        }
    }

}
